import rightnow6.lite as rightnow6
from  rightnow6.base import *

class TestNode():
	def __init__(self, album):
		self.name = "test"
		self.childs = []
		self.pos = Point(0, 0)
		self.centerpos = Point(64, 64)
		self.surface = album.fetch("testerimg\\test128x128_32_1")
	
		self.dir = Vector(1, 1)
	def Pos(self):
		return self.pos
	
	def advance(self):
		self.pos += (self.dir * 5)
		if self.pos.x < 0:
			self.dir = Vector(1, self.dir.y)
		if self.pos.y < 0:
			self.dir = Vector(self.dir.x, 1)
		if self.pos.x > 640:
			self.dir = Vector(-1, self.dir.y)
		if self.pos.y > 480:
			self.dir = Vector(self.dir.x, -1)
			
		
	def inputevent(self, event):
		pass
		

if __name__ == '__main__':
	album = rightnow6.Album()
	displaynode = rightnow6.DisplayNode(hasborder=True, size=Size(640,480))

	testnode = TestNode(album)
	displaynode.childs.append(testnode)

	rightnow6.Run(displaynode)
